#ifndef _ROS_aibots_robot_msgs_Motec_h
#define _ROS_aibots_robot_msgs_Motec_h

#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"

namespace aibots_robot_msgs
{

  class Motec : public ros::Msg
  {
    public:
      uint16_t error[2];
      typedef int8_t _stop_type;
      _stop_type stop;
      int8_t mode[2];
      int16_t drivers[2];

    Motec():
      error(),
      stop(0),
      mode(),
      drivers()
    {
    }

    virtual int serialize(unsigned char *outbuffer) const
    {
      int offset = 0;
      for( uint32_t i = 0; i < 2; i++){
      *(outbuffer + offset + 0) = (this->error[i] >> (8 * 0)) & 0xFF;
      *(outbuffer + offset + 1) = (this->error[i] >> (8 * 1)) & 0xFF;
      offset += sizeof(this->error[i]);
      }
      union {
        int8_t real;
        uint8_t base;
      } u_stop;
      u_stop.real = this->stop;
      *(outbuffer + offset + 0) = (u_stop.base >> (8 * 0)) & 0xFF;
      offset += sizeof(this->stop);
      for( uint32_t i = 0; i < 2; i++){
      union {
        int8_t real;
        uint8_t base;
      } u_modei;
      u_modei.real = this->mode[i];
      *(outbuffer + offset + 0) = (u_modei.base >> (8 * 0)) & 0xFF;
      offset += sizeof(this->mode[i]);
      }
      for( uint32_t i = 0; i < 2; i++){
      union {
        int16_t real;
        uint16_t base;
      } u_driversi;
      u_driversi.real = this->drivers[i];
      *(outbuffer + offset + 0) = (u_driversi.base >> (8 * 0)) & 0xFF;
      *(outbuffer + offset + 1) = (u_driversi.base >> (8 * 1)) & 0xFF;
      offset += sizeof(this->drivers[i]);
      }
      return offset;
    }

    virtual int deserialize(unsigned char *inbuffer)
    {
      int offset = 0;
      for( uint32_t i = 0; i < 2; i++){
      this->error[i] =  ((uint16_t) (*(inbuffer + offset)));
      this->error[i] |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
      offset += sizeof(this->error[i]);
      }
      union {
        int8_t real;
        uint8_t base;
      } u_stop;
      u_stop.base = 0;
      u_stop.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
      this->stop = u_stop.real;
      offset += sizeof(this->stop);
      for( uint32_t i = 0; i < 2; i++){
      union {
        int8_t real;
        uint8_t base;
      } u_modei;
      u_modei.base = 0;
      u_modei.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
      this->mode[i] = u_modei.real;
      offset += sizeof(this->mode[i]);
      }
      for( uint32_t i = 0; i < 2; i++){
      union {
        int16_t real;
        uint16_t base;
      } u_driversi;
      u_driversi.base = 0;
      u_driversi.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
      u_driversi.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
      this->drivers[i] = u_driversi.real;
      offset += sizeof(this->drivers[i]);
      }
     return offset;
    }

    const char * getType(){ return "aibots_robot_msgs/Motec"; };
    const char * getMD5(){ return "cb7f56271cee83801cd5db9e23a1132a"; };

  };

}
#endif